package com.monika.main.system.dao;

import io.lettuce.core.dynamic.annotation.Param;
import org.apache.ibatis.jdbc.SQL;

import java.util.LinkedHashMap;
import java.util.List;

/**
 * @author:whh
 * @date: 2025-05-20 21:32
 * <p></p>
 */
public class SQLProvider {


    public String SQL(@Param("columns") String[] columns,LinkedHashMap<String,Object>condition){
        SQL sql=new SQL();
        sql.FROM("sys_user");
        sql.SELECT(columns);
        condition.forEach((k,v)->{
            sql.WHERE(k+"="+v);
        });
        return sql.toString();
    }


    public static void main(String[] args) {

        SQLProvider sqlProvider = new SQLProvider();

        LinkedHashMap<String,Object> arg=new LinkedHashMap<>();
        arg.put("user_id","1");
        String sql = sqlProvider.SQL(new String[]{"user_id", "user_name"}, arg);

        System.out.println(sql);


    }
}
